﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPages/Default.Master" CodeBehind="Default.aspx.vb" Inherits="GuildCMS.Account._Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<script runat="server">
    ' Databind the cascading drop down boxes inorder to not have issues when posting AJAX returned data.
    Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
        RegisterValuesForCombos()
        MyBase.Render(writer)
    End Sub
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../CSS/Account/Default.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.validate.min.js" type="text/javascript"></script>
    
    <!-- jQuery validate JavaScript. -->
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            $("#form1").validate();
        });
    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <!-- Add a ToolkitScriptManager to the page. -->
    <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </ajaxToolkit:ToolkitScriptManager>

    <!-- If the member has yet to select a main character tell them to do so now. -->
    <asp:Label ID="lblSelectMainNow" runat="server" Visible="false" Text="Yoou must select a main character now before continuing."></asp:Label>

    <!-- Begin Current Charater List -->
    <div>
        <asp:Label ID="lblCharacters" runat="server" Text="Your Charaters:"></asp:Label><br />
        
        <%-- First Repeater (Displays Games) --%>
        <asp:Repeater ID="repGames" OnItemDataBound="repGames_ItemDataBound" runat="server">
            <ItemTemplate>
                <%# Eval("Game_Name")%><br />
                
                <%-- Second Repeater (Displays Realms) --%>
                <asp:Repeater ID="repRealms" OnItemDataBound="repRealms_ItemDataBound" runat="server">
                    <ItemTemplate>
                        &nbsp;&nbsp;<%# Eval("Realm_Name")%><br />

                        <%-- Third Repeater (Displays Characters) --%>
                        <asp:Repeater ID="repCharaters" runat="server">
                            <ItemTemplate>
                            &nbsp; &nbsp; &nbsp; &nbsp;<%# Eval("Character_Name")%><br />
                            </ItemTemplate>
                        </asp:Repeater>
                    </ItemTemplate>
                </asp:Repeater>
            </ItemTemplate>
        </asp:Repeater>
    </div>
    <!-- End Current Charater List -->
    
    <!-- Begin Add Charater Form -->
    <ajaxToolkit:CascadingDropDown
        ID="cddGame"
        TargetControlID="ddlGame"
        Category="Game"
        PromptText="Select a game..."
        ServicePath="~/Account/Service.asmx"
        ServiceMethod="GetGames"
        runat="server" />
    <ajaxToolkit:CascadingDropDown
        ID="cddRealm"
        TargetControlID="ddlRealm"
        ParentControlID="ddlGame"
        Category="Realm"
        PromptText="Select a realm..."
        ServicePath="~/Account/Service.asmx"
        ServiceMethod="GetRealms"
        runat="server" />
    <ajaxToolkit:CascadingDropDown
        ID="cddFaction"
        TargetControlID="ddlFaction"
        ParentControlID="ddlRealm"
        Category="Faction"
        PromptText="Select a faction..."
        ServicePath="~/Account/Service.asmx"
        ServiceMethod="GetFactions"
        runat="server" />
    <ajaxToolkit:CascadingDropDown
        ID="cddRace"
        TargetControlID="ddlRace"
        ParentControlID="ddlFaction"
        Category="Race"
        PromptText="Select a race..."
        ServicePath="~/Account/Service.asmx"
        ServiceMethod="GetRaces"
        runat="server" />
    <ajaxToolkit:CascadingDropDown
        ID="cddGender"
        TargetControlID="ddlGender"
        ParentControlID="ddlRace"
        Category="Gender"
        PromptText="Select a Gender..."
        ServicePath="~/Account/Service.asmx"
        ServiceMethod="GetGenders"
        runat="server" />
    <ajaxToolkit:CascadingDropDown
        ID="cddClass"
        TargetControlID="ddlClass"
        ParentControlID="ddlRace"
        Category="Class"
        PromptText="Select a class..."
        ServicePath="~/Account/Service.asmx"
        ServiceMethod="GetClasses"
        runat="server" />
    
    <div>
        <div><asp:Label ID="lblAddCharater" runat="server">Add new character.</asp:Label></div>
        <div class="formelement">
            <asp:Label ID="lblName" AssociatedControlID="txtName" runat="server" Text="Name:"></asp:Label><br />
            <asp:TextBox ID="txtName" runat="server" MaxLength="100" CssClass="required"></asp:TextBox>
            <asp:CustomValidator ID="valName" runat="server"
                Display="Dynamic"
                ValidateEmptyText="true"
                ControlToValidate="txtName"
                ErrorMessage="There was an error processing this field."
                OnServerValidate="valName_ServerValidate">
            </asp:CustomValidator>
        </div>
        <div class="formelement">
            <asp:Label ID="lblGame" AssociatedControlID="ddlGame" runat="server" Text="Game:"></asp:Label><br />
            <asp:DropDownList ID="ddlGame" DataSourceID="SqlDataSource1" DataTextField="Game_Name" DataValueField="Game_Id" CssClass="required" runat="server">
            </asp:DropDownList>
            <asp:CustomValidator ID="valGame" runat="server"
                Display="Dynamic"
                ValidateEmptyText="true"
                ControlToValidate="ddlGame"
                ErrorMessage="There was an error processing this field."
                OnServerValidate="valGame_ServerValidate">
            </asp:CustomValidator>
        </div>
        <div class="formelement">
            <asp:Label ID="lblRealm" AssociatedControlID="ddlRealm" runat="server" Text="Realm:"></asp:Label><br />
            <asp:DropDownList ID="ddlRealm" DataSourceID="SqlDataSource2" DataTextField="Realm_Name" DataValueField="Realm_Id" CssClass="required" runat="server">
            </asp:DropDownList>
            <asp:CustomValidator ID="valRealm" runat="server"
                Display="Dynamic"
                ValidateEmptyText="true"
                ControlToValidate="ddlRealm"
                ErrorMessage="There was an error processing this field."
                OnServerValidate="valRealm_ServerValidate">
            </asp:CustomValidator>
        </div>
        <div class="formelement">
            <asp:Label ID="lblFaction" AssociatedControlID="ddlFaction" runat="server" Text="Faction:"></asp:Label><br />
            <asp:DropDownList ID="ddlFaction" DataSourceID="SqlDataSource3" DataTextField="Faction_Name" DataValueField="Faction_Id" CssClass="required" runat="server">
            </asp:DropDownList>
            <asp:CustomValidator ID="valFaction" runat="server"
                Display="Dynamic"
                ValidateEmptyText="true"
                ControlToValidate="ddlFaction"
                ErrorMessage="There was an error processing this field."
                OnServerValidate="valFaction_ServerValidate">
            </asp:CustomValidator>
        </div>
        <div class="formelement">
            <asp:Label ID="lblRace" AssociatedControlID="ddlRace" runat="server" Text="Race:"></asp:Label><br />
            <asp:DropDownList ID="ddlRace" DataSourceID="SqlDataSource4" DataTextField="Race_Name" DataValueField="Race_Id" CssClass="required" runat="server">
            </asp:DropDownList>
            <asp:CustomValidator ID="valRace" runat="server"
                Display="Dynamic"
                ValidateEmptyText="true"
                ControlToValidate="ddlRace"
                ErrorMessage="There was an error processing this field."
                OnServerValidate="valRace_ServerValidate">
            </asp:CustomValidator>
        </div>
        <div class="formelement">
            <asp:Label ID="lblGender" AssociatedControlID="ddlGender" runat="server" Text="Gender:"></asp:Label><br />
            <asp:DropDownList ID="ddlGender" DataSourceID="SqlDataSource6" DataTextField="Gender_Name" DataValueField="Gender_Id" CssClass="required" runat="server">
            </asp:DropDownList>
            <asp:CustomValidator ID="valGender" runat="server"
                Display="Dynamic"
                ValidateEmptyText="true"
                ControlToValidate="ddlGender"
                ErrorMessage="There was an error processing this field."
                OnServerValidate="valGender_ServerValidate">
            </asp:CustomValidator>
        </div>
        <div class="formelement">
            <asp:Label ID="lblClass" AssociatedControlID="ddlClass" runat="server" Text="Class:"></asp:Label><br />
            <asp:DropDownList ID="ddlClass" DataSourceID="SqlDataSource5" DataTextField="Class_Name" DataValueField="Class_Id" CssClass="required" runat="server">
            </asp:DropDownList>
            <asp:CustomValidator ID="valClass" runat="server"
                Display="Dynamic"
                ValidateEmptyText="true"
                ControlToValidate="ddlClass"
                ErrorMessage="There was an error processing this field."
                OnServerValidate="valClass_ServerValidate">
            </asp:CustomValidator>
        </div>

        <div><asp:Button ID="btnAddCharater" runat="server" Text="Submit" /></div>
    </div>
    <!-- End Add Charater Form -->

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SqlConnectionString %>" 
        SelectCommand="sp_public_getGames" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SqlConnectionString %>" 
        SelectCommand="sp_public_getRealms" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SqlConnectionString %>" 
        SelectCommand="sp_public_getFactions" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SqlConnectionString %>" 
        SelectCommand="sp_public_getRaces" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource5" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SqlConnectionString %>" 
        SelectCommand="sp_public_getClasses" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource6" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SqlConnectionString %>" 
        SelectCommand="sp_public_getGenders" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
</asp:Content>
